Insert variable in a file name

Hello everyone,
First of all, sorry for my bad English, it's not my former language.

I would like to insert the value of one (or more) variable(s) in a file name because I need to create a different file each time I go into a specific loop.
Does someone know how to do that ? I searched on the internet but couldn't find anything.

Thank you very much.


Liise - Wed Jun 29 08:13:11 EDT 2016

Re: Insert variable in a file name
DOORSHAM - Wed Jun 29 11:32:20 EDT 2016

Question is a little abstract to easily answer.

Please provide the pseudo code where you generate the name of the file and what variable you want to insert into the filename.

 

 

Re: Insert variable in a file name
Liise - Thu Jun 30 02:26:51 EDT 2016

Oh I'm sorry I will give you an example of what I would like to do :

 

Item item_module

for item_module in current Project do

{

 string type_module = type( item_module )

 if( type_module != "Formal" ) {

        continue

    }

Module m = read(fullName(item_module),false)

string type_module_tm = probeAttr_( m, "TM Type Module" )        

 string grp = m."Name"  

FileName = "P:\\file_[type_module_tm]_[grp].csv"
.........

That's a reduced version of my code !
In fact I would like to place the value of type_module_tm and grp  in the name that we can see above.

Re: Insert variable in a file name
DOORSHAM - Thu Jun 30 05:11:36 EDT 2016

Liise - Thu Jun 30 02:26:51 EDT 2016

Oh I'm sorry I will give you an example of what I would like to do :

 

Item item_module

for item_module in current Project do

{

 string type_module = type( item_module )

 if( type_module != "Formal" ) {

        continue

    }

Module m = read(fullName(item_module),false)

string type_module_tm = probeAttr_( m, "TM Type Module" )        

 string grp = m."Name"  

FileName = "P:\\file_[type_module_tm]_[grp].csv"
.........

That's a reduced version of my code !
In fact I would like to place the value of type_module_tm and grp  in the name that we can see above.

Change  line:     FileName = "P:\\file_[type_module_tm]_[grp].csv"

 

to line:                FileName = "P:\\file_"     type_module_tm      " _ "      grp     " .csv"

 

 

Re: Insert variable in a file name
Liise - Thu Jun 30 10:06:28 EDT 2016

DOORSHAM - Thu Jun 30 05:11:36 EDT 2016

Change  line:     FileName = "P:\\file_[type_module_tm]_[grp].csv"

 

to line:                FileName = "P:\\file_"     type_module_tm      " _ "      grp     " .csv"

 

 

Oh god I didn't think of concatenation ! Thank you very much !